<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Model;

class TaskStep extends Model
{
    protected $casts = [
        'step_img' => 'json',
    ];

    public function setStepImgAttribute($step_img)
    {
        if (is_array($step_img)) {
            $this->attributes['step_img'] = json_encode($step_img);
        }
    }

    public function getStepImgAttribute($step_img)
    {
        return json_decode($step_img, true);
    }

    public function task()
    {
        return $this->belongsTo(task::class);
    }

    
    
}
